const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('electronAPI', {
    closeWindow: () => ipcRenderer.send('close-window'),
    downloadTemplate: () => ipcRenderer.invoke('download-template'), // 暴露给渲染进程
    saveExcel: (param) => ipcRenderer.invoke('save-excel', param), // 暴露给渲染进程
});

contextBridge.exposeInMainWorld('api', {
    QueryUserPage: (param) => {
        return ipcRenderer.invoke('UserPage', param)
    },
    InsertUser: (param) => {
        return ipcRenderer.invoke('HandleInsert', param)
    },
    UpdateUser: (param) => {
        return ipcRenderer.invoke('HandleUpdate', param)
    },
    DeleteUserById: (id) => {
        return ipcRenderer.invoke('HandleDelete', id)
    }
});
